package com.test.common.entity.perf;

import com.test.common.utils.SystemUtils;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;
import java.util.Set;

@Data
@Entity
@Table(name = "t_perf_task", uniqueConstraints = @UniqueConstraint(columnNames = "name"))
public class PerfTaskEntity {

    public PerfTaskEntity() {}

    public PerfTaskEntity(String name, String description, String creator, int rampTime, int duration) {
        this();
        this.name = name;
        this.description = description;
        this.creator = creator;
        this.rampTime = rampTime;
        this.duration = duration;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int id;

    @Column(columnDefinition = "VARCHAR(65) NOT NULL DEFAULT '' COMMENT '任务名称' ")
    private String name;

    @Column(columnDefinition = "VARCHAR(128) NOT NULL DEFAULT '' COMMENT '任务名称' ")
    private String description;

    @Column(columnDefinition = "VARCHAR(32) NOT NULL DEFAULT 'TODO' COMMENT '任务创建人，如：张三'")
    private String creator;

    @Column(columnDefinition = "INT(11) NOT NULL COMMENT '线程启动时间，单位：秒'")
    private int rampTime;

    @Column(columnDefinition = "INT(11) NOT NULL COMMENT '线程启动时间，单位：秒'")
    private int duration;

    @Column(columnDefinition = "DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '任务创建时间'")
    private Date createTime = new Date();

    @Column(columnDefinition = "DATETIME NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '任务修改时间'")
    private Date modifyTime = new Date();
}
